# _*_ coding: UTF-8 _*_
# @Time     : 2021/11/3 15:12
# @Author   : 郑鲁明
# @Site     : http://www.hzdledu.cn/
# @File     : case.py
# @Software : PyCharm
import time
import unittest
from selenium import webdriver
from web_d5_pom.page.loging_page import LoginPage
from web_d5_pom.page.main_page import MainPage
from web_d5_pom.page.personner_report import PersonnerReport

class LoginCase(unittest.TestCase):

    def setUp(self) -> None:
        self.driver = webdriver.Chrome()
        self.login_page = LoginPage(self.driver)
        self.mainpage = MainPage(self.driver)
        self.personnerreport = PersonnerReport(self.driver)

    def test1(self):
        # 登录
        self.driver.get('http://192.168.6.113/cloud/#/open/login')
        self.driver.maximize_window()
        self.login_page.input_user('admin')
        self.login_page.input_password('123456')
        self.login_page.input_vcode('8888')
        self.login_page.click_login()

        self.personnerreport.jump_to()  #跳转至人事报表界面
        self.personnerreport.query_open() # 打开查询条件界面
        self.personnerreport.starttimequery('2020-09-04') # 输入开始时间
        self.personnerreport.endtimequery('2021-09-04') # 输入结束时间
        self.personnerreport.query_funtion() # 点击查询

        # 退出登录
        self.mainpage.move_to_icon()
        self.mainpage.click_logout()

    def tearDown(self) -> None:
        self.driver.quit()


if __name__ == '__main__':
    logincase = LoginCase()
    logincase.setUp()
    logincase.test1()
    logincase.tearDown()